Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

isNewRequest 메서드를 json 직렬화 대상에서 제외 #739

Merged
merged 4 commits into from
Nov 29, 2024

Conversation

Hanjaemo
Copy link
Member

@Hanjaemo Hanjaemo commented Nov 25, 2024

💡 작업 내용

  • isNewRequest를 json 직렬화 대상에서 제외

💡 자세한 설명

Spring이 json 처리에 사용하는 Jackson 라이브러리는 직렬화/역직렬화 과정에서 getter/setter를 사용합니다.
(이는 DTO에 getter가 있어야 하는 이유이기도 합니다.)

여기서 중요한 점은, boolean 타입의 경우 jackson은 is~ 메서드를 getter로 판단한다는 것입니다.
즉, swagger 요청 body에 newRequest가 나타난 이유는 jackson이 isNewRequest 메서드를 getter로 인식해서 직렬화에 포함시켰기 때문입니다.

따라서 isNewRequest 메서드에 @JsonIgnore 어노테이션을 추가하여 직렬화/역직렬화 대상에서 제외했습니다.

✅ 셀프 체크리스트

  • PR 제목을 형식에 맞게 작성했나요?
  • 브랜치 전략에 맞는 브랜치에 PR을 올리고 있나요?
  • 이슈는 close 했나요?
  • Reviewers, Labels, Projects를 등록했나요?
  • 작업 도중 문서 수정이 필요한 경우 잘 수정했나요?
  • 테스트는 잘 통과했나요?
  • 불필요한 코드는 제거했나요?

closes #726

Summary by CodeRabbit

  • 버그 수정
    • isNewRequest 메서드에 @JsonIgnore 주석 추가로 JSON 직렬화 및 역직렬화 시 해당 메서드가 무시됩니다.

@Hanjaemo Hanjaemo added ⚙️ chore 세팅 관련 D-2 여유롭지 않으면서 일반적인 작업 labels Nov 25, 2024
@Hanjaemo Hanjaemo self-assigned this Nov 25, 2024
Copy link
Contributor

coderabbitai bot commented Nov 25, 2024

Walkthrough

이 변경 사항은 TempTalkPickDto 클래스 내의 SaveTempTalkPickRequest 정적 클래스의 isNewRequest 메서드에 @JsonIgnore 주석을 추가하는 것입니다. 이 주석은 해당 메서드가 JSON 직렬화 및 역직렬화 과정에서 무시되어야 함을 나타냅니다. 메서드의 로직은 변경되지 않았으며, 다른 수정 사항은 없습니다.

Changes

파일 경로 변경 요약
src/main/java/balancetalk/talkpick/dto/TempTalkPickDto.java isNewRequest 메서드에 @JsonIgnore 주석 추가

Assessment against linked issues

Objective Addressed Explanation
Swagger에서 메서드가 요청 body에 나타나는 문제 해결 (#726)

Poem

🐰 새로운 요청은 숨겨졌네,
JSON 속에 보이지 않게,
메서드의 이름은 사라지고,
깔끔한 API를 위해 달려가네!
변화의 순간을 축하해,
토끼의 기쁨, 함께 나누세! 🌟


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@Hanjaemo Hanjaemo changed the title isNewRequest를 json 직렬화 대상에서 제외 isNewRequest 메서드를 json 직렬화 대상에서 제외 Nov 25, 2024
@Hanjaemo Hanjaemo added D-1 and removed D-2 여유롭지 않으면서 일반적인 작업 labels Nov 25, 2024
@@ -41,6 +42,7 @@ public TempTalkPick toEntity(Member member) {
.build();
}

@JsonIgnore
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

매우 킹따봉 유용한 어노테이션이죠~ 👍

@Hanjaemo Hanjaemo added D-0 긴급 이슈에 대한 작업 and removed D-1 labels Nov 26, 2024
@Hanjaemo Hanjaemo merged commit a34cce7 into main Nov 29, 2024
3 checks passed
@Hanjaemo Hanjaemo deleted the refactor/726-swagger-temp-talk-pick-request-body branch December 1, 2024 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⚙️ chore 세팅 관련 D-0 긴급 이슈에 대한 작업
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[Swagger] 요청 body에 필드가 아닌 메서드가 존재하는 문제
3 participants